TextPosition
TextPosition[text,form] gives a list of the starting and ending positions at which instances of form occur in text.
TextPosition[text,{form1,form2,…}] gives an association of results for all the types formi.
TextPosition[text,formspec,n] gives the positions of the first n cases found.
Please visit the official Wolfram Language Reference for more details and examples on core symbols.